package com.huo.common.enumtype;

import java.util.HashMap;
import java.util.Map;

/**
 * 文件状态枚举
 */
public enum FtpFileStatusEnum {

	FTPFILE_STATUS_HANDLE("0", "服务器正在处理"),
	FTPFILE_STATUS_DOWNLOAD("1", "服务器处理完成，可下载"),
	FTPFILE_STATUS_FISH("2", "文件下载成功"),
	FTPFIEL_STATUS_UNZIP("3","解压成功"),
	FTPFIEL_STATUS_IMPORT("4","导入成功成功"),
	FTPFIEL_STATUS_UPLOAD("5","上传成功");
	

	private static Map<String, FtpFileStatusEnum> nameMap = new HashMap<String, FtpFileStatusEnum>(10);
	private static Map<String, FtpFileStatusEnum> codeMap = new HashMap<String, FtpFileStatusEnum>(10);

	static {
		FtpFileStatusEnum[] allValues = FtpFileStatusEnum.values();
		for (FtpFileStatusEnum obj : allValues) {
			nameMap.put(obj.getName(), obj);
			codeMap.put(obj.getCode(), obj);
		}
	}

	private String name;
	private String code;

	private FtpFileStatusEnum(String code, String name) {
		this.name = name;
		this.code = code;

	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public static FtpFileStatusEnum parseByName(String name) {
		return nameMap.get(name);
	}

	public static FtpFileStatusEnum parseByCode(String code) {
		return codeMap.get(code);
	}

	@Override
	public String toString() {
		return this.name;
	}
}
